<template>
    <div class="page-subbook">
        <div class="page-subbook-header">
            <div>{{ item.name }} (0/{{ item.children.length }})</div>
            <div class="page-subbook-options" :class="{'page-subbook-optionsc': item.show}" @click="handlerSubShow(item)"></div>
        </div>
        <div class="page-subbook-itembox" v-if="item.show">
            <div class="page-subbook-item" v-for="(aitem,index) in item.children" :key="index">
                <div class="page-subbook-personitem">
                    <div class="page-subbook-personimg"></div>
                    <div class="page-subbook-personname">{{ aitem.name }}</div>
                </div>
                <div class="page-subbook-personitemmap"></div>
            </div>
        </div>
    </div>
</template>

<script setup>
    import { ref, defineProps, defineEmits } from 'vue'
    const emits = defineEmits(['emitshow'])
    const props = defineProps({
        item: {
            type: Object,
            default: () => {}
        },
        index: {
            type: [Number, String],
            default: 0 
        }
    })

    const handlerSubShow = (e) => {
        emits('emitshow', props.index)
    }

</script>

<style lang="scss" scoped>
.page-subbook{
    &-header{
        display: flex;
        flex-direction: row;
        padding-left: 12px;
        justify-content: space-between;
        color: #fff;
        font-size: 14px;
        margin-bottom: 8px;
        align-items: center;
    }
    &-itembox{
        background: #02223B;
        margin-left: 12px;
        padding: 8px;
    }
    &-options{
        height: 24px;
        width: 24px;
        background: url("@/assets/home/downicon.png") center center no-repeat;
        background-size: 24px auto;
        cursor: pointer;
    }
    &-optionsc{
        background: url("@/assets/home/righticon.png") center center no-repeat;
        background-size: 24px auto;
    }
    &-item{
        height: 50px;
        // background: #2F7AFE;
        display: flex;
        align-items: center;
        padding: 0 12px;
        cursor: pointer;
        
    }
    &-personitem{
        flex:1;
        display: flex;
        flex-direction: row;
        align-items: center;
    }
    &-personimg{
        width: 26px;
        height: 26px;
        border-radius: 26px;
        background: #fff;
        margin-right: 6px;
        
    }
    &-personname{
        flex:1;
        color: #fff;
        font-size: 14px;
    }
    &-personitemmap{
        width: 24px;
        height: 24px;
        background: url("@/assets/home/mapicon.png") center center no-repeat;
        background-size: 13px auto;
    }
}
</style>